<template>
	<div class="container">
		<h3>投诉举报</h3>

		<div style="margin-top:50px;">
			<h4>标题: {{data.headline}}</h4>
			<div style="font-size: 12px;margin-top:10px;">
				<span>所属企业:  &nbsp; {{data.enterprise}}</span>
				<span style="margin-left: 100px;">追溯码: &nbsp; {{data.traceCode}}</span>
			</div>
			<div style="font-size: 12px;display:flex;margin-top:10px;">
				<div>反馈内容：</div>
				<div>
					<div>{{data.content}}</div>
					<div style="margin-top:10px;">反馈时间：{{data.reportTime}}</div>
				</div>
			</div>
			<div style="font-size: 12px;color: red; display:flex;margin-top:20px;">
				<el-input
					type="textarea"
					:rows="2"
					placeholder="请填写回复内容"
					style="width:80%;"
					v-model="reply">
				</el-input>
			</div>
		</div>
		<div class="footerFixed" label-width="0px" style="margin-bottom:20px;">
          <el-button type="primary" style="margin:0 20px;" @click="save">提交</el-button>
          <el-button @click="goback">取消</el-button>
		</div>
	</div>
</template>

<script>
	import { report_selectId,report_update } from "@/request/supervisionCenterApi.js"
	export default{
		data(){
			return{
				data: {},
				id: '',
				reply: ''
			}
		},
		mounted(){
			this.id = this.$route.query.id
			this.init()
		},
		methods:{
			init() {
				let reportData = {
					id: this.id
				}
				report_selectId(reportData).then((res) =>{
					this.data = res.data
				})
			},
			//提交回复
			save(){
				let replyData = {
					report: {}
				}
				replyData.report.id = this.id	//id
				replyData.report.headline = this.data.headline	//标题
				replyData.report.content = this.data.content	//内容
				replyData.report.reply = this.reply	//reply 回复
				replyData.report.productName = this.data.productName	//productName 产品名称
				replyData.report.enterprise = this.data.enterprise	//enterprise 企业
				replyData.report.traceCode = this.data.traceCode	//traceCode	追溯码
				replyData.report.state = this.data.state	//state	受理状态

				console.log(replyData);
				report_update(replyData).then((res) =>{
					this.$notify({
						    title: '提示',
						    message: '回复成功',
						    type: 'success',
						    duration:1000
						});
					this.$router.go(-1)
				})
			},
			goback(){
				this.$router.go(-1)
			}
		}
	}
</script>

<style scoped>
	
</style>